﻿@using VirtualPress.Infrastructure.Entities.Entity;
@using VirtualPress.Tool.Framework;
@using VirtualPress.Infrastructure.HitMonitor;
@{
    Layout = "/Views/Shared/_Main.cshtml";
    }
@section head{
    <!-- MogFocus -->
    <link href="/Content/css/MogFocus.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/hotjournals.css" rel="stylesheet" type="text/css" />
}
<!-- gallery -->
<div class="container">
    <div class="mini-layout" style="height: auto">
        <div id="warpper">
            <div id="focus">
                <div class="focusWarp">
                    <ul class="imgList_two">
                        <li>
                            <img alt="中华科教出版社" src="/Content/img/index/one_size.png" /></li>
                        <li>
                            <img alt="传播文化、促进交流" src="/Content/img/index/two_size.png" /></li>
                        <li>
                            <img alt="高端检索" src="/Content/img/index/thr_size.png" /></li>
                    </ul>
                    <ul class="imgList" style="float: right">
                        <li>
                            <img alt="中华科教出版社" src="/Content/img/index/thr.jpg" width="800" height="320" /></li>
                        <li>
                            <img alt="传播文化、促进交流" src="/Content/img/index/two.jpg" width="800" height="320" /></li>
                        <li>
                            <img alt="高端检索" src="/Content/img/index/one.jpg" width="800" height="320" /></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- main content -->
<div class="container">
    <div class="row">
        <div class="span3">
            <div class="mini-layout">
                @RenderPage("~/Views/Shared/Partial/_Quiklinks.cshtml")
                <div class="hspace10">
                </div>
                <div class="hspace15">
                </div>
                @RenderPage("~/Views/Shared/Partial/_Newbooks.cshtml")
                <div class="hspace10">
                </div>
                <div class="hspace15">
                </div>
                @RenderPage("~/Views/Shared/Partial/_Consult.cshtml")
            </div>
        </div>
        <div class="span9">
            <!-- 滚动期刊 -->
            <div class="mini-layout" style="height: auto">
                <div id="demo" style="overflow: hidden; width: 100%;">
                    <table>
                        <tbody>
                            <tr>
                                <td id="demo1">
                                      <div style="width:1612px;">
                                      @{List<Periodical> journals = ViewBag.Journals;
                                        if (journals != null)
                                        {
                                            foreach (var item in journals)
                                            {
                                        <div class="hotjournals"><a href="/journals/home/detail/@item.Id" target="_blank">
                                            <img alt="@item.Name" src="@item.CoverImg" /></a></div>
                                            }
                                        }}
                                      </div>
                                </td>
                                <td id="demo2">
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- 新闻动态 -->
            <table class="table">
                <thead>
                    <tr>
                        <th style="width: 90%;">
                            <h4>
                                新闻动态</h4>
                        </th>
                        <th style="text-align: center;">
                            <a href="/Home/News" title="more"><i class="icon-align-justify"></i></a>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @{
                        List<VirtualPress.Infrastructure.Entities.Entity.News> data = ViewBag.News;
                        if (data != null)
                        {
                            int flag = 0;
                            foreach (var item in data)
                            {
                                if (flag < 3)
                                {
                        <tr>
                            <td>
                                <a href="/home/newsdetails/@item.Id" target="_blank">@item.Title</a>
                            </td>
                            <td style="text-align: right; color:gray">
                                @item.CreateDate.ToString("yy-MM-dd")
                            </td>
                        </tr>
                                    flag++;
                                }

                            }
                        }
                    }
                </tbody>
            </table>
            <!-- 最新文章 -->
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th style="width: 90%;">
                            <h4>
                                最新文章</h4>
                        </th>
                        <th style="text-align: center;">
                            <a href="#" title="more"><i class="icon-align-justify"></i></a>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @{List<Article> articles = ViewBag.PublishArticle;
                      if (articles != null && articles.Any())
                      {
                          foreach (var article in articles)
                          {
                              var attechment = article.Appendix.FirstOrDefault(c => c.AttachmentStatus == VirtualPress.Infrastructure.Entities.Enum.AttachmentStatus.DingGao);
                              var authorsList = article.ArticleAuthor.Select(c => c.AuthorName).ToList();
                              string authors = string.Empty;
                              for (int i = 0, len = authorsList.Count(); i < len; i++)
                              {
                                  authors += authorsList[i];
                                  if (i != len - 1)
                                  {
                                      authors += "，";
                                  }
                              }
                              int dm = HitMonitor.Instance(HitName.Article, article.Id).GetValue<ArticleHitPack>().DownloadNumber;
                         <tr>
                            <td>
                                <h5>
                                    <a href="/manuscripts/index/@article.Id" target="_blank">@article.Title</a></h5>
                                @article.Title_EN<br />
                                作者：@authors<br />
                                @article.Journal.Name 第 @article.journalItem.Manuscriptcode 期,&nbsp;&nbsp;&nbsp; <a href="/download?token=@EncodeByBase64.Encode(new { id = attechment.Id, journal = article.Peri_Id, article=article.Id, type = 9 }.ToJson())" title="下载" target="_blank">
                                    <i class="icon-download"></i></a> (@( attechment == null ? "" : attechment.Format + " " + attechment.Size)&nbsp; <a class="label label-info" title="下载数">@dm</a> )
                            </td>
                            <td style="text-align: center">
                                <a href="/download?token=@EncodeByBase64.Encode(new { id = attechment.Id, journal = article.Peri_Id, article = article.Id, type = 9 }.ToJson())" title="下载" target="_blank">
                                    <i class="icon-download-alt"></i></a>
                            </td>
                        </tr>
                          }
                      }
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript" src="/scripts/easing.js"></script>
    <script type="text/javascript" src="/scripts/MogFocus.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#lihome').addClass('active');
        });
        $(function () {
            $("#focus").mogFocus({ loadAnimation: false, time: 4000, scrollWidth: 'auto',
                prevNextToggle: 'toggle', btnStyle: 'noNumber', prevNextToggle: 'hide', animationWay: 'fade', randeasing: 'easeOutQuad'
            });
        });
        var speed = 35//速度数值越大速度越慢  
        demo2.innerHTML = demo1.innerHTML
        function Marquee() {
            if (demo2.offsetWidth - demo.scrollLeft <= 0)
                demo.scrollLeft -= demo1.offsetWidth
            else {
                demo.scrollLeft++
            }
        }
        var MyMar = setInterval(Marquee, speed)
        demo.onmouseover = function () { clearInterval(MyMar) }
        demo.onmouseout = function () { MyMar = setInterval(Marquee, speed) }
    </script>
}
